﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using JohnnySins.DAL;
using JohnnySins.DAL.Repositories;
using JohnnySins.Entities;
using JohnnySins.Code;

namespace JohnnySins
{
    public partial class Home : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadData();
            }
        }

        public void LoadData()
        {
            using (var repo = RepositoryFactory.ResolveRepository<RecentSceneRepository>())
            {
                rptScene.DataSource = repo.FindActive();
                rptScene.DataBind();
            }

            using (var repo = RepositoryFactory.ResolveRepository<ParameterSiteRepository>())
            {
                lblWelcomeNote.Text = "";
                ParameterSite itm = repo.Find("WelcomeNote");
                if ((itm != null) && (!string.IsNullOrEmpty(itm.ParameterValueStr)))
                    lblWelcomeNote.Text = itm.ParameterValueStr;
            }
        }
    }
}